package xcmg.device.dao.mapper.delivery;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.delivery.DeliveryReceiptDO;
import xcmg.device.dao.entity.delivery.DeliveryReceiptExportDO;
import xcmg.device.service.vo.delivery.DeliveryReceiptQueryParam;
import xcmg.device.service.vo.delivery.DeliveryReceiptVO;
import xcmg.device.service.vo.logistic.BusinessOrderSelectedInfoVO;
import xcmg.device.service.vo.logistic.SelectBusinessBillResultVO;
import xcmg.device.service.vo.logistic.SelectBusinessBillsQueryParamVO;
import xcmg.device.service.vo.report.WornOutReportQueryParam;
import xcmg.device.service.vo.report.WornOutReportQueryResult;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Mapper
public interface DeliveryReceiptMapper {
    int deleteByPrimaryKey(String id);

    int insert(DeliveryReceiptDO record);

    DeliveryReceiptDO item(String id);

    DeliveryReceiptDO itemByNo(@Param("billNo")String billNo);

    List<DeliveryReceiptDO> itemByIds(@Param("ids")List<String> ids);

    int update(DeliveryReceiptDO record);

    int editupdate(DeliveryReceiptDO record);
    //更新审核信息，更新的时候不用判断不为空才更新，因为可能存在清空审核人，审核意见等操作，所以直接用传的参数赋值
    int updateAuditInfo(@Param("ids") List<String> ids,@Param("auditStatus") String auditStatus,
                         @Param("auditId") String auditId,@Param("auditName") String auditName,
                         @Param("auditDesc") String auditDesc,@Param("auditMessage") String auditMessage);

    List<DeliveryReceiptDO> list(DeliveryReceiptVO record);

    List<DeliveryReceiptDO>  listWarehousePermit(DeliveryReceiptQueryParam queryParam);

    List<DeliveryReceiptDO> listAll(DeliveryReceiptVO record);

    int boxDetailCount(@Param("deliveryReceiptId")String deliveryReceiptId,@Param("deliveryNoteId")String deliveryNoteId);

    List<DeliveryReceiptDO> billNoByNoteNo(@Param("deliveryNoteNo")String deliveryNoteNo);

    List<DeliveryReceiptExportDO> listForExportDelivery(DeliveryReceiptVO condition);

    int listCountForExportDelivery(DeliveryReceiptVO condition);

    List<DeliveryReceiptExportDO> listForExportThree(DeliveryReceiptVO condition);

    int listCountForExportThree(DeliveryReceiptVO condition);

    List<DeliveryReceiptExportDO> listForExportRegion(DeliveryReceiptVO condition);

    int listCountForExportRegion(DeliveryReceiptVO condition);

    List<DeliveryReceiptExportDO> listForExportAbnormal(DeliveryReceiptVO condition);

    int listCountForExportAbnormal(DeliveryReceiptVO condition);

    int updateAttachName(@Param("attachName")String attachName, @Param("id")String id);

    List<DeliveryReceiptDO> list4ExpressInfo(@Param("serviceNo")String serviceNo,
                                             @Param("receiverName") String receiverName,
                                             @Param("receiverTel") String receiverTel);

    //更新交运单的接收信息，处理状态+签收时间
    int updateReceive(@Param("billNo") String billNo,@Param("deliveryStatus") String deliveryStatus,@Param("receiveDate") Date receiveDate);

    //id是单据编号
    ArrayList<String> selectNumbers(@Param( "id" ) String id, @Param( "orgId" ) String orgId );
    //旧件报表查询
    List<WornOutReportQueryResult> wornOutReport(WornOutReportQueryParam param);

    DeliveryReceiptDO itemByNoWithDetail(String billNo);

    List<DeliveryReceiptDO>  list4JckDomestic(DeliveryReceiptQueryParam param);

    List<DeliveryReceiptDO>  list4JckOverseas(DeliveryReceiptQueryParam param);

    int updateJckBillNo(@Param("jckBillNo")String jckBillNo, @Param("id")String id);
    
    DeliveryReceiptDO getInfoByBoxupId(String boxupId);

    Integer countWaitAuditData(String orgId);
    //创建物流运单时查询，排除掉已经全部创建了物流运单的数据
    List<SelectBusinessBillResultVO> list4LogisticWaybill(SelectBusinessBillsQueryParamVO param);
    //指定单据中未被创建物流运单的零件集合，按照单据号+零件号排序
    List<BusinessOrderSelectedInfoVO.Materials> listNotBeLogisticWayMaterials(@Param("businessOrders") List<String> businessOrders);
}
